package com.topvision.gsj.launcher;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.Instrumentation;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AccelerateInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import cn.com.aidl.IVoiceService;
import cn.com.aidl.VoiceService;

import com.topvision.gsj.launcher.adapter.AppFragmentAdapter;
import com.topvision.gsj.launcher.domain.AppInfo;
import com.topvision.gsj.launcher.util.DateUtil;
import com.topvision.gsj.launcher.util.FixedSpeedScroller;
import com.topvision.gsj.library.AndroidUtil;
import com.topvision.gsj.library.BaseActivity;
import com.topvision.gsj.library.BaseFragmentActivity;
import com.topvision.gsj.library.TouchInterface;
import com.topvision.gsj.library.constant.TopVisionConstant;
import com.topvision.gsj.library.constant.TopVisionConstant;
import com.topvision.gsj.library.constant.VoiceConstant;
import com.topvision.gsj.library.util.ToolsUtil;
import com.topvision.gsj.library.view.NoScrollViewPager;

/**
 * 
 * <p>
 * Title: LauncherActivity
 * </p>
 * <p>
 * Description:手机UI主页面,充当手机桌面来使用
 * </p>
 * <p>
 * Company: topvision
 * </p>
 * 
 * @author jackGu
 * @date 2016-4-27
 */
@SuppressLint({ "Recycle", "HandlerLeak" })
public class LauncherActivity extends BaseFragmentActivity implements
		OnClickListener, TouchInterface {

	private NoScrollViewPager viewPager;
	// 整个launcherActivity的View对象
	private View allView;
	private TextView clockTime;
	// 根据wifi连接状态显示或不显示wifi图片
	private ImageView wifiImage;
	BatteryView batteryView;
	ImageView scanView;

	public final int UPDATE_TIME = 1;
	Thread timeThread;

	// 当前activity实例对象
	public static LauncherActivity activityInstance;
	// 构造适配器
	private List<Fragment> fragments = new ArrayList<Fragment>();
	// 用于viewpager滑动速度控制
	private FixedSpeedScroller mScroller;
	// 存放已安裝app集合
	private List<AppInfo> appList;
	Timer clockTimer;
	TimerTask clockTimerTask;
	// 廣播接收者
	LauncherReceiver launcherReceiver;
	AppFragmentAdapter appFragmentAdapter;
	List<String> needAppsList = null;
	boolean clickWoAnFlag = false;
	boolean voiceFlag = false;
	SharedPreferences preferences;

	// 常量
	private final static int SCANNIN_GREQUEST_CODE = 1;
	private final static String TOPVISION_PACKAGE = "com.topvision.gsj";
	private final static String TOPVISION_LAUNCHER_PACKAGE = "com.topvision.gsj.launcher";
	private final static String FACE_RECOG = "com.example.facerecognew";
	Context context;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_launcher);
		// preferences =
		// getSharedPreferences(TopVisionConstant.TOPVISIONLAUNCHER,
		// MODE_PRIVATE);

		context = this;
		bindAIDL();
		initUI();
		AndroidUtil.startBlueTooth(context);
		new LauncherAysnTask(this).execute();
		registerLauncher();
		// boolean isFirst = preferences.getBoolean(TopVisionConstant.IS_FIRST,
		// true);
		// 开启语记
		// if (isFirst) {
		// preferences.edit().putBoolean(TopVisionConstant.IS_FIRST, false);
		// // ComponentName componentName = new ComponentName(
		// // appInfo[0], appInfo[1]);
		// // Intent intent = new Intent();
		// // intent.setComponent(componentName);
		// // intent.setAction(Intent.ACTION_VIEW);
		// // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		// // startActivity(intent);
		// }

	}

	/**
	 * 
	 * <p>
	 * Title: 初始化视图
	 * </p>
	 * <p>
	 * Description:初始化UI，並且設置了ViewPager的滑动速度
	 * </p>
	 */
	private void initUI() {
		Field mField;
		try {
			viewPager = (NoScrollViewPager) findViewById(R.id.viewpager);
			viewPager.setNoScroll(true);
			allView = findViewById(R.id.allView);

			mField = ViewPager.class.getDeclaredField("mScroller");
			mField.setAccessible(true);
			// 设置加速度
			// ，通过改变FixedSpeedScroller这个类中的mDuration来改变动画时间（如mScroller.setmDuration(mMyDuration);）
			mScroller = new FixedSpeedScroller(viewPager.getContext(),
					new AccelerateInterpolator());
			mScroller.setmDuration(500);
			mField.set(viewPager, mScroller);

		} catch (Exception e) {
			e.printStackTrace();
		}

		// 当前时间控件
		clockTime = (TextView) findViewById(R.id.clockTime);
		wifiImage = (ImageView) findViewById(R.id.wifiImage);
		batteryView = (BatteryView) findViewById(R.id.battery_view);

	}

	public class MyOnPageChangeListener implements OnPageChangeListener {

		@Override
		public void onPageSelected(int position) {
		}

		@Override
		public void onPageScrolled(int position, float positionOffset,
				int positionOffsetPixels) {
			// to refresh frameLayout
			if (allView != null) {
				allView.invalidate();
			}
		}

		@Override
		public void onPageScrollStateChanged(int arg0) {
		}
	}

	/**
	 * 
	 * <p>
	 * Title: 获取app集合
	 * </p>
	 * <p>
	 * Description: 初始化一些要显示的应用信息放入集合當中
	 * </p>
	 */
	private void getAppInfos() {
		appList = new ArrayList<AppInfo>();
		Intent intent = new Intent(Intent.ACTION_MAIN, null);
		intent.addCategory(Intent.CATEGORY_LAUNCHER);
		List<ResolveInfo> mApps = getPackageManager().queryIntentActivities(
				intent, 0);
		for (ResolveInfo info : mApps) {
			AppInfo tmpInfo = new AppInfo();
			// 应用图标
			tmpInfo.setAppIcon(info.activityInfo.loadIcon(getPackageManager()));
			// 应用的包名
			tmpInfo.setPackageName(info.activityInfo.packageName);
			// 类名全路径
			tmpInfo.setClassName(info.activityInfo.name);
			// 应用名称
			tmpInfo.setAppName(info.activityInfo.loadLabel(getPackageManager())
					.toString());

			String pkgName = tmpInfo.getPackageName();

			// TODO 只是爲了演示
			if (tmpInfo.getPackageName().equals(
					TopVisionConstant.ORIGIN_SHI_JIA_PACKAGE)) {
				tmpInfo.setAppName(TopVisionConstant.SHI_JIA);
				// tmpInfo.setAppIcon(getResources().getDrawable(R.drawable.video));
			}
			// 要显示的是系统应用并且是TopVision公司开发的
			boolean topvisionFlag = pkgName.contains(TOPVISION_PACKAGE)
					&& !pkgName.equals(TOPVISION_LAUNCHER_PACKAGE);
			// 需要显示的应用
			boolean needFlag = needAppsList != null
					&& needAppsList.contains(pkgName);
			if (topvisionFlag || needFlag) {
				appList.add(tmpInfo);

			}
		}

	}

	/**
	 * 
	 * <p>
	 * Title: 初始化viewpager内容
	 * </p>
	 * <p>
	 * Description: 將fragment 頁面加入viewpager中
	 * </p>
	 */
	private void initPagerItems() {
		for (AppInfo appInfo : appList) {
			fragments.add(AppFragment.newInstance(appInfo));
		}
		viewPager.setOnPageChangeListener(new MyOnPageChangeListener());
		// TODO 之前用的是Fragment+VIEWPAGER，但出现滑动问题，故暂时先放弃了
		appFragmentAdapter = new AppFragmentAdapter(
				getSupportFragmentManager(), fragments);
		viewPager.setAdapter(appFragmentAdapter);
		// 设置2张图之前的间距。
		viewPager.setPageMargin(200);
		viewPager.setCurrentItem(1);
		// viewPager.setOffscreenPageLimit(appList.size());

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		default:
			break;
		}

	}

	public static LauncherActivity getInstance() {
		return activityInstance;
	}

	/**
	 * 处理模拟请求
	 * 
	 * @param x
	 * @param y
	 */
	public boolean processSimulateRequest(float x, float y, int width,
			int height, String action) {
		// 点击操作
		if (TopVisionConstant.ACTION_CLICK.equals(action)) {
			// return handleAction(x, y, width, height);
		}
		// 返回操作
		else if (TopVisionConstant.ACTION_BACK.equals(action)) {
			onBackPressed();
		}
		// 翻页到上一个APP显示
		else if (TopVisionConstant.ACTION_PREVIOUS.equals(action)
				|| action
						.contains(VoiceConstant.LAUNCHER_ACTIVITY_PREVIOUS_PAGE)
				|| action.contains(VoiceConstant.LAUNCHER_ACTIVITY_LEFT_PAGE)) {
			if (viewPager != null) {
				viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
			}
		}
		// 翻页到上一个APP显示
		else if (TopVisionConstant.ACTION_NEXT.equals(action)
				|| action.contains(VoiceConstant.LAUNCHER_ACTIVITY_NEXT_PAGE)
				|| action.contains(VoiceConstant.LAUNCHER_ACTIVITY_RIGHT_PAGE)) {
			if (viewPager != null) {
				viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
			}
		}

		return true;
	}

	private Handler handler = new Handler() {
		public void handleMessage(Message msg) {
			switch (msg.what) {
			case UPDATE_TIME:
				clockTime.setText(DateUtil.getYMDHMS(new Date()));
				break;
			default:
				break;
			}
		};
	};

	protected void onStart() {
		super.onStart();
		// HeadTrackUtil.startHeadTrack(this);
	};

	@Override
	protected void onResume() {
		super.onResume();
		setTouchInterfaceListern(this);
		com.topvision.gsj.library.AndroidUtil.killProcess(
				TopVisionConstant.ORIGIN_VIDEO_TRANSFER_PACKAGE, this);

		startTimer();
		setWifi();
		// 重新恢復進入woan前的狀態
		if (voiceFlag
				&& clickWoAnFlag
				&& !ToolsUtil.isServiceRun(this,
						TopVisionConstant.VOICETRACK_SERIVCE_NAME)
				&& voiceService != null) {
			clickWoAnFlag = false;
			try {
				voiceService.onReceive("START_VOICE");
			} catch (RemoteException e) {
				e.printStackTrace();
			}
		}
		activityInstance = this;

	}

	protected void onPause() {
		super.onPause();
		stopTimer();
		activityInstance = null;

	};

	@Override
	protected void onDestroy() {
		super.onDestroy();
		unRegisterLauncher();
		if (bindFlag) {
			unbindService(conn);
		}

		// if (conn != null) {
		// unbindService(conn);
		// }

	}

	/**
	 * 设置wifi图片是否可见
	 * <p>
	 * Title: setWifi
	 * </p>
	 * <p>
	 * Description:
	 * </p>
	 */
	public void setWifi() {
		// 檢測wifi是否連接
		boolean wifiConnected = AndroidUtil.isWifiConnected(this);
		if (wifiConnected) {
			wifiImage.setVisibility(View.VISIBLE);
		} else {
			wifiImage.setVisibility(View.GONE);
		}
	}

	/**
	 * 开启系统时间计时器
	 * <p>
	 * Title: startTimer
	 * </p>
	 * <p>
	 * Description:
	 * </p>
	 */
	private void startTimer() {
		// 開啓時間計時器
		if (clockTimer == null) {
			clockTimer = new Timer();
		}
		if (clockTimerTask == null) {
			clockTimerTask = new ClockTimeTask();
		}

		clockTimer.schedule(clockTimerTask, 1000, 1000);
	}

	/**
	 * 关闭系统计时器Timer,节省手机内部资源
	 * <p>
	 * Title: stopTimer
	 * </p>
	 * <p>
	 * Description:
	 * </p>
	 */
	private void stopTimer() {
		if (clockTimer != null) {
			clockTimer.cancel();
			clockTimer = null;
		}

		if (clockTimerTask != null) {
			clockTimerTask.cancel();
			clockTimerTask = null;
		}
	}

	/**
	 * 時間計時器
	 * <p>
	 * Title: TimeClockTask
	 * </p>
	 * <p>
	 * Description:与系统时间相对应，便于用户在自定义的launcher中查看时间信息
	 * </p>
	 * <p>
	 * Company: topvision
	 * </p>
	 * 
	 * @author jackGu
	 * @date 2016-4-28
	 */
	class ClockTimeTask extends TimerTask {

		@Override
		public void run() {
			Message message = handler.obtainMessage(UPDATE_TIME);
			handler.sendMessage(message);
		}

	}

	/**
	 * 註冊Launcher這個acitivty的廣播
	 * <p>
	 * Title: registerBattery
	 * </p>
	 * <p>
	 * Description:
	 * </p>
	 */
	private void registerLauncher() {
		IntentFilter intentFilter = new IntentFilter();
		intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
		intentFilter.addAction("android.intent.action.CAMERA_BUTTON");

		intentFilter.addAction(TopVisionConstant.ACTION_PREVIOUS);
		intentFilter.addAction(TopVisionConstant.ACTION_NEXT);
		intentFilter.addAction(VoiceService.VOICE_ACTION);
		intentFilter.addAction(TopVisionConstant.ACTION_BACK_HOME);
		intentFilter.addAction(TopVisionConstant.ACTION_SHOW_SETTING);
		IntentFilter intentFilter2 = new IntentFilter();
		// 用來包的变化监听
		intentFilter2.addAction(Intent.ACTION_PACKAGE_ADDED);
		intentFilter2.addAction(Intent.ACTION_PACKAGE_REMOVED);
		intentFilter2.addDataScheme("package");
		if (launcherReceiver == null) {
			launcherReceiver = new LauncherReceiver();
		}
		registerReceiver(launcherReceiver, intentFilter);
		registerReceiver(launcherReceiver, intentFilter2);

	}

	/**
	 * 取消电量监听
	 * <p>
	 * Title: unRegisterBattery
	 * </p>
	 * <p>
	 * Description:
	 * </p>
	 */
	private void unRegisterLauncher() {
		if (launcherReceiver != null) {
			unregisterReceiver(launcherReceiver);
		}
	}

	/**
	 * 電量廣播接收者
	 * <p>
	 * Title: BatteryReceiver
	 * </p>
	 * <p>
	 * Description:監聽手機電量變化狀態,並且發送廣播給LauncherActivity顯示電量情況
	 * </p>
	 * <p>
	 * Company: topvision
	 * </p>
	 * 
	 * @author jackGu
	 * @date 2016-4-28
	 */
	public class LauncherReceiver extends BroadcastReceiver {

		public static final String ACTION_BATTERY_CHANGE = "batter_change";
		public static final String BATTERY_LEVEL = "batter_level";

		@Override
		public void onReceive(Context context, Intent intent) {
			String action = intent.getAction();
			// 電話變化廣播接收者
			if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
				int rawlevel = intent.getIntExtra("level", -1);
				int scale = intent.getIntExtra("scale", -1);
				int level = -1; // percentage, or -1 for unknown
				if (rawlevel >= 0 && scale > 0) {
					level = (rawlevel * 100) / scale;
				}
				if (batteryView != null) {
					batteryView.setPower(level);
				}
			}
			// ViewPager 翻页
			else if (TopVisionConstant.ACTION_PREVIOUS.equals(action)
					|| TopVisionConstant.ACTION_NEXT.equals(action)) {
				processSimulateRequest(0, 0, 0, 0, action);
			} else if (VoiceService.VOICE_ACTION.equals(action)) {
				String text = intent.getStringExtra(VoiceService.VOICE_DATA);
				processVoiceCommand(text);
			} else if (TopVisionConstant.ACTION_BACK_HOME.equals(action)) {
				Intent intent2 = new Intent(getApplicationContext(),
						LauncherActivity.class);
				startActivity(intent2);
			} else if (action.equals(Intent.ACTION_PACKAGE_ADDED)) {
				String packageName = intent.getDataString();
				packageName = packageName.replace("package:", "");
				addPackage(packageName);

			} else if (action.equals(Intent.ACTION_PACKAGE_REMOVED)) {
				String packageName = intent.getDataString();
				packageName = packageName.replace("package:", "");
				removePackage(packageName);
			} else if (action.equals("android.intent.action.CAMERA_BUTTON")) {
				System.out.println(action);
			} else if (action.equals(TopVisionConstant.ACTION_SHOW_SETTING)) {
				showSetting();
			}
		}

	}

	/**
	 * 处理语音
	 * 
	 * @Title: processVoiceCommand
	 * @Description:
	 * @param @param text
	 * @return void
	 * @throws
	 */
	public void processVoiceCommand(String text) {
		// 內容中包含"下一页"文字内容即执行翻页操作
		if (text.contains(VoiceConstant.LAUNCHER_ACTIVITY_PREVIOUS_PAGE)
				|| text.contains(VoiceConstant.LAUNCHER_ACTIVITY_NEXT_PAGE)) {
			processSimulateRequest(0, 0, 0, 0, text);
		}
		// 菜單操作
		else if (text.contains(VoiceConstant.LAUNCHER_ACTIVITY_SETTING)) {
			showSetting();
		} else if (text.equals(TopVisionConstant.VIDEO_TRANSFER)) {
			voiceFlag = true;
			clickWoAnFlag = true;
		}
	}

	/**
	 * 添加包事件處理
	 * 
	 * @param packageName
	 */
	private void addPackage(String packageName) {
		AppInfo tmpInfo = new AppInfo();
		ResolveInfo info = AndroidUtil.getByPackageName(LauncherActivity.this,
				packageName);
		// 应用图标
		tmpInfo.setAppIcon(info.activityInfo.loadIcon(getPackageManager()));
		// 应用的包名
		tmpInfo.setPackageName(info.activityInfo.packageName);
		// 类名全路径
		tmpInfo.setClassName(info.activityInfo.name);
		// 应用名称
		tmpInfo.setAppName(info.activityInfo.loadLabel(getPackageManager())
				.toString());
		// TODO 這裏只是爲了演示效果添加判斷
		if (TopVisionConstant.ORIGIN_SHI_JIA_PACKAGE.equals(tmpInfo
				.getPackageName())) {
			tmpInfo.setAppName(TopVisionConstant.SHI_JIA);
		}
		boolean topvisionFlag = packageName.contains(TOPVISION_PACKAGE)
				&& !tmpInfo.getPackageName().equals(TOPVISION_LAUNCHER_PACKAGE);
		// 需要显示的应用
		boolean needFlag = needAppsList != null
				&& needAppsList.contains(packageName);
		if (topvisionFlag || needFlag) {
			fragments.add(AppFragment.newInstance(tmpInfo));
			if (appFragmentAdapter != null) {
				appFragmentAdapter.updateData(fragments);
			} else {
				appFragmentAdapter = new AppFragmentAdapter(
						getSupportFragmentManager(), fragments);
				viewPager.setAdapter(appFragmentAdapter);

			}
		}

	}

	/**
	 * 删除应用的事件处理,UI变化展现
	 * 
	 * @param packageName
	 */
	private void removePackage(String packageName) {
		int appIndex = -1;
		for (int i = 0; fragments != null && i < fragments.size(); i++) {
			Bundle bundle = fragments.get(i).getArguments();
			AppInfo appInfo = bundle.getParcelable(AppFragment.APP_INFO);
			if (packageName.equals(appInfo.getPackageName())) {
				appIndex = i;
				break;
			}
		}
		// 删除fragment
		if (appIndex != -1) {
			fragments.remove(appIndex);
			if (appFragmentAdapter != null) {
				appFragmentAdapter.updateData(fragments);
			} else {
				appFragmentAdapter = new AppFragmentAdapter(
						getSupportFragmentManager(), fragments);
				viewPager.setAdapter(appFragmentAdapter);

			}
		}

	}

	class LauncherAysnTask extends AsyncTask<String, Integer, String> {
		Context context;

		public LauncherAysnTask(Context context) {
			this.context = context;
		}

		@Override
		protected String doInBackground(String... params) {
			String result = "";
			try {
				needAppsList = com.topvision.gsj.library.AndroidUtil
						.getFromAssets("app", context);
				getAppInfos();
				result = "success";
			} catch (Exception e) {
				e.printStackTrace();
				result = "";
			}

			return result;
		}

		@Override
		protected void onPostExecute(String result) {
			super.onPostExecute(result);
			if ("success".equals(result)) {
				initPagerItems();
				// setTimeZone();
			}
		}

	}

	@Override
	public void doForwardTouch() {
		processSimulateRequest(0, 0, 0, 0, TopVisionConstant.ACTION_NEXT);
	}

	@Override
	public void doBackwardTouch() {
		processSimulateRequest(0, 0, 0, 0, TopVisionConstant.ACTION_PREVIOUS);
	}

	@Override
	public void doClickTouch() {
		// switch (currentId) {
		// case R.id.allView:
		// viewpager的点击事件
		if (fragments != null && fragments.size() > 0) {
			Fragment currentFragment = fragments
					.get(viewPager.getCurrentItem());
			Bundle bundle = currentFragment.getArguments();
			final AppInfo appInfo = (AppInfo) bundle
					.getParcelable(AppFragment.APP_INFO);
			// WoAn视频和讯飞科大语音视频冲突影响声音,需要将其关闭
			if (TopVisionConstant.ORIGIN_VIDEO_TRANSFER_PACKAGE.equals(appInfo
					.getPackageName())) {
				clickWoAnFlag = true;
				if (ToolsUtil.isServiceRun(this,
						TopVisionConstant.VOICETRACK_SERIVCE_NAME)) {
					// 进入前WoAn前语音是打开的
					voiceFlag = true;
					if (voiceService != null) {
						try {
							voiceService.onReceive("STOP_VOICE");
						} catch (RemoteException e) {
							e.printStackTrace();
						}
					}
				} else {
					voiceFlag = false;
				}
			}
			ComponentName componentName = new ComponentName(
					appInfo.getPackageName(), appInfo.getClassName());
			Intent intent = new Intent();
			intent.setComponent(componentName);
			startActivity(intent);
		}

		// break;

		// }

	}

	@Override
	public void doDoubleTouch() {
		System.out.println("doDoubleTouch");
	}

	/**
	 * 设置区时
	 * 
	 * @Title: setTimeZone
	 * @Description:
	 * @param 设定文件
	 * @return void 返回类型
	 * @throws
	 */
	// private void setTimeZone() {
	// AlarmManager mAlarmManager = (AlarmManager)
	// getSystemService(Context.ALARM_SERVICE);
	// mAlarmManager.setTimeZone("Asia/Shanghai");
	// }

	IVoiceService voiceService;
	boolean bindFlag = false;

	private void bindAIDL() {
		bindFlag = bindService(new Intent(
				"com.smartvision.voicedemo.VoiceService"), conn,
				BIND_AUTO_CREATE);
	}

	ServiceConnection conn = new ServiceConnection() {

		public void onServiceDisconnected(ComponentName arg0) {
			voiceService = null;
		}

		@Override
		public void onServiceConnected(ComponentName arg0, IBinder service) {
			voiceService = IVoiceService.Stub.asInterface(service);
			// 开启语音控制
			// if (voiceService != null) {
			// try {
			// voiceService.onReceive("START_VOICE");
			// } catch (RemoteException e) {
			// e.printStackTrace();
			// }
			// }
		}
	};

	/**
	 * 显示菜单或隐藏
	 * 
	 * @Title: showSetting
	 * @Description:
	 * @param 设定文件
	 * @return void 返回类型
	 * @throws
	 */
	private void showSetting() {
		if (voiceService != null) {
			try {
				voiceService.onReceive(TopVisionConstant.ACTION_SHOW_SETTING);
			} catch (RemoteException e) {
				e.printStackTrace();
			}
		}
	}

}
